//
//  ZEmoticonCellButton.swift
//  swift-weibo
//
//  Created by zero on 17/3/31.
//  Copyright © 2017年 zero. All rights reserved.
//

import UIKit

class ZEmoticonCellButton: UIButton {

  
    //  记录按钮的模型属性
    var emotionModel:ZEmoticonModel?{
        
        didSet{
            
            if emotionModel?.type == "1" {
                
                self.setTitle(emotionModel?.code?.emoji(), for: .normal)
                self.setImage(nil, for: .normal)
            }else{
                
                let image = UIImage(named: emotionModel!.allPath!, in: ZBundleTools.share.getPath(), compatibleWith: nil)
                
                self.setImage(image, for: .normal)
                
                self.setTitle(nil, for: .normal)
            }
            
        }
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
    }
    
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    

}
